#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
        int i = 0;
        int j = 0;
        int k = 0;
        int n = 0;
        int p = 0;
        int q = 0;
        int a[20][20] = { 0 };
        int count=0;
        scanf("%d", &n);
        count = 0;
        p = 0;
        q = n - 1;
        while (count < n * n) {
            for (i = p; i <= q; i++)
                a[p][i] = ++count;
            for (i = p + 1; i <= q; i++)
                a[i][q] = ++count;
            for (i = q - 1; i >= p; i--)
                a[q][i] = ++count;
            for (i = q - 1; i >= p + 1; i--)
                a[i][p] = ++count;
            ++p;
            --q;

        }
        for (i = 0; i < n; i++)
        {
            for (j = 0; j < n; j++)
                printf("%d ", a[i][j]);
            printf("\n");
        }
}